#ifndef __PS2_H
#define __PS2_H

#include "STC15.h"


sbit PS2_CLK = P3^2 ;
sbit PS2_DAT = P5^5 ;


#define	PS2MODE_CMD			0x00
#define	PS2MODE_MOUSE		0x20
#define	PS2MODE_KEYBOARD	0x10

#define PS2_EnableReport	EX0 = 1; \
							PS2_CLK = 1 ; \
							PS2_DAT = 1
							
#define PS2_DisableReport	EX0 = 0; \
							PS2_CLK = 0 ; \
							PS2_DAT = 1

typedef struct
{
	unsigned char	BitCount ;
	unsigned char	Verify ;
	unsigned char	DataTemp ;
	unsigned char	PS2Mode ;
	unsigned char	ID ;
	unsigned char	DataBuf[16] ;
	unsigned int	test ;
}typ_PS2 ;

extern typ_PS2	PS2 ;


void PS2_Init(void) ;

unsigned char PS2_SendCMD( unsigned char cmd ) ;
unsigned char PS2_GetByte(void) ;
void PS2_Delayus( unsigned int t) ;

#endif

